//展示任务表内容
import { Space, Table } from "antd";
import type { TableProps } from "antd";
import { TaskTableType } from "@/store/interface";

const columns: TableProps<TaskTableType>["columns"] = [
  {
    title: "发布者",
    dataIndex: "user",
    key: "user",
    render: (text) => <a>{text}</a>,
  },
  {
    title: "类型",
    dataIndex: "type",
    key: "type",
  },
  {
    title: "任务名称",
    dataIndex: "title",
    key: "title",
  },
  {
    title: "状态",
    key: "state",
    dataIndex: "state",
  },
  {
    title: "奖励",
    key: "reward",
    dataIndex: "reward",
  },
  {
    title: "创建时间",
    key: "time",
    dataIndex: "time",
  },
  {
    title: "任务时间",
    key: "task_time",
    dataIndex: "task_time",
  },
  {
    title: "操作",
    key: "action",
    dataIndex: "action",
    render: (_, _record) => (
      <Space size="middle">
        <a>撰写 </a>
        <a>删除</a>
      </Space>
    ),
  },
];

interface AppProps {
  data: TaskTableType[];
}

const App: React.FC<AppProps> = ({ data }) => (
  <Table<TaskTableType> columns={columns} dataSource={data} />
);

export default App;
